package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class GenericDemo {
    public static void main(String[] args) {
        Collection<Point> c = new ArrayList<>();
        c.add(new Point(1,3));
        c.add(new Point(2,4));
        c.add(new Point(5,7));
        c.add(new Point(6,8));

        Iterator<Point> it = c.iterator();
        while (it.hasNext()){
            Point a = it.next();
            System.out.println(a);
        }

        for (Point point : c) {
            System.out.println(point);
        }






        /*
        Collection<String> c = new ArrayList<>();
        c.add("李");
        c.add("总");
        c.add("666");

        Iterator<String> it = c.iterator();
        while (it.hasNext()){
            String str = it.next();
            System.out.println(str);
        }
        for (String s : c) {
            System.out.println(s);
        }
         */
    }
}
